//
//  kWListsItem.m
//  EasyToTesco2.0
//
//  Created by 杨森 on 2017/5/25.
//  Copyright © 2017年 EasyToTesco. All rights reserved.
//

#import "kWListsItem.h"

@interface  kWListsItem()

@property(nonatomic,strong)UIImageView   *contentImg;
@property(nonatomic,strong)UILabel       *contentName;
@property(nonatomic,strong)UILabel       *contentEnglish;
@property(nonatomic,strong)UILabel       *contentPrice;

@end

@implementation kWListsItem

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        [self buildSubViews];
    }
    return self;
}

- (void)buildSubViews
{
    [self.contentView addSubview:self.contentImg];
    [self.contentView addSubview:self.contentName];
    [self.contentView addSubview:self.contentEnglish];
    [self.contentView addSubview:self.contentPrice];

}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    
    self.contentImg.frame = CGRectMake(0,0,self.width, self.Height * 0.72);
    WeakSelf(self);
    [self.contentName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(weakself);
        make.top.equalTo(weakself.contentImg.mas_bottom).offset(0);
    }];
    
    [self.contentEnglish mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(weakself);
        make.top.equalTo(weakself.contentName.mas_bottom).offset(5);
    }];
    
    [self.contentPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(weakself);
        make.top.equalTo(weakself.contentEnglish.mas_bottom).offset(0);
    }];
    
}

#pragma mark lazy
- (UIImageView *)contentImg
{
    if (!_contentImg) {
        _contentImg = [[UIImageView alloc] init];
        _contentImg.image = [UIImage imageNamed:@"kW_list_chair"];
    }return _contentImg;
}

- (UILabel *)contentName
{
    if (!_contentName) {
        _contentName = [[UILabel alloc] init];
        _contentName.font = FONT(13);
        _contentName.textAlignment = NSTextAlignmentCenter;
        _contentName.text = @"简易时尚弓椅";
    }
    return _contentName;
}

- (UILabel *)contentEnglish
{
    if (!_contentEnglish) {
        _contentEnglish = [[UILabel alloc] init];
        _contentEnglish.font = FONT(10);
        _contentEnglish.textColor = [UIColor lightGrayColor];
        _contentEnglish.textAlignment = NSTextAlignmentCenter;
        _contentEnglish.text = @"arch chair";
    }
    return _contentEnglish;
}


- (UILabel *)contentPrice
{
    if (!_contentPrice) {
        _contentPrice = [[UILabel alloc] init];
        _contentPrice.textColor = UIColorFromRGB(0xfa3802);;
        _contentPrice.font = FONT(14);
        _contentPrice.textAlignment = NSTextAlignmentCenter;
        _contentPrice.text = @"¥67";
    }
    return _contentPrice;
}


@end
